/*
 *   This File is Part of CuteOgre Game Engine
 *
 *   This program is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 *	Copyright 2010 Alexandre Pires ( c.alexandre.pires@gmail.com )
 *  Created on: 2010/09/04
 */

#ifndef LAYOUT_H_
#define LAYOUT_H_

#include "WidgetContainer.h"
#include "GUIOverlay.h"
#include "Style.h"
#include "StyleSheet.h"

#include <QDomDocument>
#include <QScriptEngine>

class Layout : public WidgetContainer , public GUIOverlay {

friend class GUIManager;

private:
	StyleSheet* mStyleSheet;
	QDomDocument* mXmlDocument;
	bool mValid;
	QScriptEngine mEngine;

protected:
	Layout ( const QString& rFile );
	void draw ();
	void render ( GUIOverlay* rLayout, const QPoint& rOffset =
			QPoint (), const QRegion& rRegion = QRegion () );

private:
	QString readFileContents ( const QString& rFile );
	void setupLayout ();

public:

	~Layout ();

	inline bool isValid () {
		return mValid;
	}

	void show ();
	void hide ();

	void validateStyle ();

};

#endif /* LAYOUT_H_ */
